package cn;

import java.lang.reflect.Method;

public class CalcTest {

	public static void main(String[] args) throws Exception {
		Calc c = new Calc();
//		int r = c.add(4, 10);
//		System.out.println(r);
		Method m1 = c.getClass().getDeclaredMethod("divide", int.class, int.class);
		if (m1.isAnnotationPresent(MyAno.class))// 是否有注解
		{
			MyAno my = m1.getAnnotation(MyAno.class);// 获得注解的值
			System.out.println(my.before());
			Object r = m1.invoke(c, 10, 4);
			System.out.println("结果是：" + r);
			System.out.println(my.after());
		} else {
			Object r = m1.invoke(c, 10, 4);
			System.out.println("结果是：" + r);
		}
	}

}
